import qiniuUploader from '../../utils/qiniuUploader.js';
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    imgs: [],
  },

  /**
   * 组件的方法列表
   */
  methods: {
    choose() {
      let that = this
      wx.chooseImage({
        count: 9,
        success(res) {
          let imgs = that.data.imgs
          wx.$qiniu(res.tempFilePaths, res => {
            that.setData({
              imgs: imgs.concat(res)
            })
          })
        }
      })
    },
    del(e) {
      let that = this
      let index = e.currentTarget.dataset.index
      let imgs = that.data.imgs
      imgs.splice(index, 1)
      that.setData({
        imgs: imgs
      })
    },
    look(e) {
      let that = this
      let index = e.currentTarget.dataset.index
      let imgs = that.data.imgs
      let img = imgs[index]
      wx.previewImage({
        urls: imgs,
        current: img
      })
    }
  }
})